﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using MyOA.Model;

namespace MyOA.DAL
{
   public class CommandService
    {
       DBHelper db = new DBHelper();

       /// <summary>
       /// 查看这用户是否有这个权限
       /// </summary>
       /// <param name="loginId">登陆用户名</param>
       /// <param name="nodeId">权限ID</param>
       /// <returns>是否这用户有此权限</returns>
       public bool isHaveRoleRight(string loginId, int nodeId)
       {
           SqlParameter[] value = new SqlParameter[]
           {
               new SqlParameter("@loginId",loginId),
               new SqlParameter("@nodeId",nodeId)
           };

           if ((int)db.getScalar("sp_IsHaveRoleRight",value)>0)
           {
               return true;
           }
           else
           {
               return false;
           }
       }
    }
}
